package sketch.ui;

import java.awt.EventQueue;

import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.UIManager;

/**
 *
 * @author  zhengwt
 */
public class SegExpUI extends javax.swing.JFrame {


    public SegExpUI() {
        initComponents();
    }

    private void initComponents() {

    	setTitle("Segmentation Sampler");
    	setResizable(false);
    	setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(getJPanel(), javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(getJPanelSketch(), javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(getJPanel(), javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(getJPanelSketch(), javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
    }

    private javax.swing.JButton jButtonClear;
    private javax.swing.JButton jButtonDir;
    private javax.swing.JButton jButtonNext;
    private javax.swing.JButton jButtonPrev;
    private javax.swing.JButton jButtonSave;
    private javax.swing.JComboBox jComboBoxIndex;
    private javax.swing.JLabel jLabelDir;
    private javax.swing.JLabel jLabelIndex;
    private javax.swing.JPanel jPanel;
    private javax.swing.JPanel jPanelCommand;
    private javax.swing.JPanel jPanelSample;
    private javax.swing.JPanel jPanelSketch;
    private javax.swing.JTextField jTextFieldDir;

	public javax.swing.JButton getJButtonClear() {
		if (jButtonClear == null) {
			jButtonClear = new JButton();
	        jButtonClear.setText("Clear (Delete)");
//	        jButtonClear.set
		}
		return jButtonClear;
	}

	public javax.swing.JButton getJButtonDir() {
		if (jButtonDir == null) {
			jButtonDir = new JButton();
	        jButtonDir.setText("...");

		}
		return jButtonDir;
	}

	public javax.swing.JButton getJButtonNext() {
		if (jButtonNext == null) {
			jButtonNext = new JButton();
	        jButtonNext.setText("Next (Enter)");

		}
		return jButtonNext;
	}

	public javax.swing.JButton getJButtonPrev() {
		if (jButtonPrev == null) {
			jButtonPrev = new JButton();
	        jButtonPrev.setText("Prev (Backspace)");
		}
		return jButtonPrev;
	}

	public javax.swing.JButton getJButtonSave() {
		if (jButtonSave == null) {
			jButtonSave = new JButton();
	        jButtonSave.setText("Save (S)");
		}
		return jButtonSave;
	}

	public javax.swing.JComboBox getJComboBoxIndex() {
		if (jComboBoxIndex == null) {
			jComboBoxIndex = new JComboBox();
			jComboBoxIndex.setModel(
					new DefaultComboBoxModel(
							new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
		}
		return jComboBoxIndex;
	}

	public javax.swing.JLabel getJLabelDir() {
		if (jLabelDir == null) {
			jLabelDir = new JLabel();
			jLabelDir.setText("Save Dir:");
		}
		return jLabelDir;
	}

	public javax.swing.JLabel getJLabelIndex() {
		if (jLabelIndex == null) {
			jLabelIndex = new JLabel();
			jLabelIndex.setText("Sample Index:");
		}
		return jLabelIndex;
	}

	public javax.swing.JPanel getJPanel() {
		if (jPanel == null) {
			jPanel = new JPanel();

			javax.swing.GroupLayout jPanelLayout = new javax.swing.GroupLayout(jPanel);
	        jPanel.setLayout(jPanelLayout);
	        jPanelLayout.setHorizontalGroup(
	            jPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
	            .addGroup(jPanelLayout.createSequentialGroup()
	                .addComponent(getJPanelSample(), javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
	                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
	                .addComponent(getJPanelCommand(), javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
	        );
	        jPanelLayout.setVerticalGroup(
	            jPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
	            .addComponent(getJPanelSample(), javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
	            .addComponent(getJPanelCommand(), javax.swing.GroupLayout.PREFERRED_SIZE, 90, Short.MAX_VALUE)
	        );
		}
		return jPanel;
	}

	public javax.swing.JPanel getJPanelCommand() {
		if (jPanelCommand == null) {
			jPanelCommand = new JPanel();

			jPanelCommand.setBorder(javax.swing.BorderFactory.createTitledBorder("Command"));

	        javax.swing.GroupLayout jPanelCommandLayout = new javax.swing.GroupLayout(jPanelCommand);
	        jPanelCommand.setLayout(jPanelCommandLayout);
	        jPanelCommandLayout.setHorizontalGroup(
	            jPanelCommandLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
	            .addGroup(jPanelCommandLayout.createSequentialGroup()
	                .addContainerGap()
	                .addGroup(jPanelCommandLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
	                    .addGroup(jPanelCommandLayout.createSequentialGroup()
	                        .addComponent(getJLabelDir())
	                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
	                        .addComponent(getJTextFieldDir(), javax.swing.GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE)
	                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
	                        .addComponent(getJButtonDir(), javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE))
	                    .addGroup(jPanelCommandLayout.createSequentialGroup()
	                        .addComponent(getJButtonSave())
	                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
	                        .addComponent(getJButtonClear())))
	                .addContainerGap())
	        );
	        jPanelCommandLayout.setVerticalGroup(
	            jPanelCommandLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
	            .addGroup(jPanelCommandLayout.createSequentialGroup()
	                .addGroup(jPanelCommandLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
	                    .addComponent(getJLabelDir())
	                    .addComponent(getJTextFieldDir(), javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
	                    .addComponent(getJButtonDir()))
	                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
	                .addGroup(jPanelCommandLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
	                    .addComponent(getJButtonSave())
	                    .addComponent(getJButtonClear())))
	        );
		}
		return jPanelCommand;
	}

	public javax.swing.JPanel getJPanelSample() {
		if (jPanelSample == null) {
			jPanelSample = new JPanel();

			jPanelSample.setBorder(javax.swing.BorderFactory.createTitledBorder("Sample"));

	        javax.swing.GroupLayout jPanelSampleLayout = new javax.swing.GroupLayout(jPanelSample);
	        jPanelSample.setLayout(jPanelSampleLayout);
	        jPanelSampleLayout.setHorizontalGroup(
	            jPanelSampleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
	            .addGroup(jPanelSampleLayout.createSequentialGroup()
	                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
	                .addGroup(jPanelSampleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
	                    .addGroup(jPanelSampleLayout.createSequentialGroup()
	                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
	                        .addComponent(getJLabelIndex())
	                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
	                        .addComponent(getJComboBoxIndex(), 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
	                    .addGroup(jPanelSampleLayout.createSequentialGroup()
	                        .addComponent(getJButtonNext())
	                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
	                        .addComponent(getJButtonPrev()))))
	        );
	        jPanelSampleLayout.setVerticalGroup(
	            jPanelSampleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
	            .addGroup(jPanelSampleLayout.createSequentialGroup()
	                .addGroup(jPanelSampleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
	                    .addComponent(getJLabelIndex())
	                    .addComponent(getJComboBoxIndex(), javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
	                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
	                .addGroup(jPanelSampleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
	                    .addComponent(getJButtonPrev())
	                    .addComponent(getJButtonNext()))
	                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
	        );
		}
		return jPanelSample;
	}

	public javax.swing.JPanel getJPanelSketch() {
		if (jPanelSketch == null) {
			jPanelSketch = new JPanel();

			jPanelSketch.setBorder(javax.swing.BorderFactory.createTitledBorder("Sketch"));
	        javax.swing.GroupLayout jPanelSketchLayout = new javax.swing.GroupLayout(jPanelSketch);
	        jPanelSketch.setLayout(jPanelSketchLayout);
	        jPanelSketchLayout.setHorizontalGroup(
	            jPanelSketchLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
	            .addGap(0, 628, Short.MAX_VALUE)
	        );
	        jPanelSketchLayout.setVerticalGroup(
	            jPanelSketchLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
	            .addGap(0, 493, Short.MAX_VALUE)
	        );
		}
		return jPanelSketch;
	}

	public javax.swing.JTextField getJTextFieldDir() {
		if (jTextFieldDir == null) {
			jTextFieldDir = new JTextField();
		}
		return jTextFieldDir;
	}

	public static void main(String[] args) {
		try {
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());


		} catch (Exception e) {
			e.printStackTrace();
		}

		EventQueue.invokeLater(new Runnable() {
			public void run() {
				new SegExpUI().setVisible(true);
			}
		});
	}

}
